#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int f(int l, int r, int x)
{ // l <= x <= r
    int cnt = 0;
    while (l <= r) {
        cnt++;
        int mid = (l + r) / 2;
        if (mid == x)
            break;
        if (mid < x)
            l = mid + 1;
        else
            r = mid - 1;
    }
    return cnt;
}
int main()
{
    int cnt = 0;
    int T, l, r, x;
    scanf("%d", &T);
    while (T--)
    {
        scanf("%d%d%d", &l, &r, &x);
        printf("%d\n", f(l, r, x));
    }
    return cnt;
}